<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:c="http://java.sun.com/jsp/jstl/core">

    <ui:composition template="/template.xhtml">
        <ui:define name="title">
            <h:outputText value="#{bundle.ViewTimeLogTitle}"></h:outputText>
        </ui:define>
        <ui:define name="body">
            <h:panelGroup id="messagePanel" layout="block">
                <h:messages errorStyle="color: red" infoStyle="color: green" layout="table"/>
            </h:panelGroup>
            <h:form>
                <h:panelGrid columns="2">

                    <h:outputText value="#{bundle.ViewTimeLogLabel_project}"/>
                    <h:outputText value="#{timeLogController.selected.project.projectName}" title="#{bundle.ViewTimeLogTitle_project}"/>

                    <h:outputText value="#{bundle.ViewTimeLogLabel_task}"/>
                    <h:outputText value="#{timeLogController.selected.task}" title="#{bundle.ViewTimeLogTitle_task}"/>

                    <h:outputText value="#{bundle.ViewTimeLogLabel_activity}"/>
                    <h:outputText value="#{timeLogController.selected.activity}" title="#{bundle.ViewTimeLogTitle_activity}"/>

                    <h:outputText value="#{bundle.ViewTimeLogLabel_workedHours}"/>
                    <h:outputText value="#{timeLogController.selected.workedHours}" title="#{bundle.ViewTimeLogTitle_workedHours}"/>

                    <h:outputText value="#{bundle.ViewTimeLogLabel_date}"/>
                    <h:outputText value="#{timeLogController.selected.date}" title="#{bundle.ViewTimeLogTitle_date}">
                        <f:convertDateTime pattern="MM/dd/yyyy" />
                    </h:outputText>

                    <c:if test="${type=='admin'}">
                        <h:outputText value="#{bundle.ViewTimeLogLabel_createdAt}"/>
                        <h:outputText value="#{timeLogController.selected.createdAt}" title="#{bundle.ViewTimeLogTitle_createdAt}">
                            <f:convertDateTime pattern="MM/dd/yyyy" />
                        </h:outputText>
                    </c:if>

                    <h:outputText value="#{bundle.ViewTimeLogLabel_status}"/>
                    <h:outputText value="#{timeLogController.selected.status}" title="#{bundle.ViewTimeLogTitle_status}"/>

                    <c:if test="${type=='admin'}">
                        <h:outputText value="#{bundle.ViewTimeLogLabel_emplyee}"/>
                        <h:outputText value="#{timeLogController.selected.emplyee}" title="#{bundle.ViewTimeLogTitle_emplyee}"/>
                    </c:if>

                    <c:if test="${type=='admin'}">
                        <h:outputText value="#{bundle.ViewTimeLogLabel_createdBy}"/>
                        <h:outputText value="#{timeLogController.selected.createdBy}" title="#{bundle.ViewTimeLogTitle_createdBy}"/>
                    </c:if>

                </h:panelGrid>
                <br />
                <h:commandButton rendered="#{timeLogController.selected.status != 'submitted'}" type="submit" action="#{timeLogController.destroyAndView}" value="#{bundle.ViewTimeLogDestroyLink}"/>
                <h:commandButton rendered="#{timeLogController.selected.status != 'submitted'}" type="submit" action="Edit" value="#{bundle.ViewTimeLogEditLink}"/>
            </h:form>

            <h:form>
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                <h:commandButton type="submit" action="#{timeLogController.prepareCreate}" value="#{bundle.ViewTimeLogCreateLink}" />
                <h:commandButton rendered="${type=='admin'}" type="submit" action="#{timeLogController.prepareList}" value="#{bundle.ViewTimeLogShowAllLink}"/>
                <h:commandButton rendered="${type=='user'}" type="submit" action="#{timeLogController.listUserTimeLog}" value="#{bundle.ViewTimeLogShowAllLink}"/>
                <h:button rendered="${type=='admin'}" value="Back to Home" outcome="/index" />
                <h:button rendered="${type=='user'}" value="Back to Home" outcome="/userhome"/>
            </h:form>
        </ui:define>
    </ui:composition>

</html>
